package com.neusoft.ysu.npms.controller;


import com.neusoft.ysu.npms.pojo.Area;
import com.neusoft.ysu.npms.pojo.City;
import com.neusoft.ysu.npms.pojo.Result;
import com.neusoft.ysu.npms.service.IAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 作者：刘金秋
 * @since 2024-06-18
 */
@RestController
@RequestMapping("/area")
public class AreaController {
    @Autowired
    IAreaService areaService;

    @RequestMapping("/add")
    public Result add(@RequestBody Area area) {
//        System.out.println(area);
        areaService.add(area);
        return Result.success();
    }
    @RequestMapping("/delete")
    public Result deleteMeasure(@RequestBody Area area) {
//        System.out.println(area);
        areaService.deleteMeasure(area);
        return Result.success();
    }
    @RequestMapping("/update")
    public Result updateMeasure(@RequestBody Area area){
        areaService.updateMeasure(area);
        return Result.success();
    }

    @RequestMapping("getAll")
    public Result getAll(){
        areaService.selectAll();
        return Result.success();
    }

    @RequestMapping("findone")
    public Result findone(@RequestBody Area area){
        System.out.println(area);
        areaService.findById(area);
        return Result.success();
    }
    @RequestMapping("/citylist")
    public Result getCitylist(){
        return areaService.getCitylist();
    }
    @RequestMapping("/townlist")
    public Result getTownlist(){
        return areaService.getTownlist();
    }
    @RequestMapping("/countylist")
    public Result getCountylist(){
        return areaService.getCountylist();
    }
    @RequestMapping("/villagelist")
    public Result getVillagelist(){
        return areaService.getVillagelist();
    }
}
